import { Tag } from "antd"

import { useDigital } from "@/hooks"
import { useLocale } from "@/locales"

const memberBillWithdrawalSubReviewDetailColumns = () => {
	const { newFormat } = useLocale()
	const { renderFormat } = useDigital()

	const memberBillWithdrawalSubReviewDetail_userName = {
		title: "funds.user_name",
		width: 160
	}
	const memberBillWithdrawalSubReviewDetail_parentProxyName = {
		title: "funds.fund_audit.belong_proxy",
		width: 160
	}
	const memberBillWithdrawalSubReviewDetail_merchantName = {
		title: "common.belong_merchant",
		width: 160
	}
	const memberBillWithdrawalSubReviewDetail_accountStatus = {
		title: "common.account_status",
		render: (_: any, record: any) =>
			(() => {
				let context: string = ""
				let color = "success"
				if (record.loginLockStatus === 1) {
					context = newFormat({ id: "common.login_lock_status" })
					color = "warning"
				} else if (record.gameLockStatus === 1) {
					context = newFormat({ id: "common.game_lock_status" })
					color = "error"
				} else if (record.loginLockStatus === 0 && record.gameLockStatus === 0 && record.paymentLockStatus === 0) {
					context = newFormat({ id: "common.account_status_normal" })
					color = "success"
				}

				return (
					<span>
						<Tag color={color}>{context}</Tag>
					</span>
				)
			})(),
		width: 100
	}
	const memberBillWithdrawalSubReviewDetail_createdAt = {
		title: "report.register_date",
		width: 130
	}
	const memberBillWithdrawalSubReviewDetail_loanBillSnapshotTime = {
		title: "funds.fund_audit.snapshot_time",
		width: 160
	}
	const memberBillWithdrawalSubReviewDetail_asset = {
		title: "funds.settlement_bill_management.bill_net_assets",
		width: 160,
		render: renderFormat
	}
	const memberBillWithdrawalSubReviewDetail_shouldRepay = {
		title: "funds.settlement_bill_management.payable_bill_loan",
		width: 160,
		render: renderFormat
	}
	const memberBillWithdrawalSubReviewDetail_withdrawAvailable = {
		title: "funds.settlement_bill_management.withdrawable_limit",
		width: 160,
		render: renderFormat
	}
	const memberBillWithdrawalSubReviewDetail_cashAvailable = {
		title: "report.center_wallet_balance",
		width: 160,
		render: renderFormat
	}
	const memberBillWithdrawalSubReviewDetail_creditAvailable = {
		title: "funds.settlement_bill_management.credit_wallet_balance",
		width: 160,
		render: renderFormat
	}
	const memberBillWithdrawalSubReviewDetail_creditTotal = {
		title: "funds.fund_audit.credit_limit",
		width: 160,
		render: renderFormat
	}
	const memberBillWithdrawalSubReviewDetail_historyBillPeriod = {
		title: "funds.fund_audit.bill_date",
		width: 160
	}
	const memberBillWithdrawalSubReviewDetail_generatedTime = {
		title: "funds.fund_audit.generation_time",
		width: 160
	}
	const memberBillWithdrawalSubReviewDetail_historyAsset = {
		title: "funds.settlement_bill_management.bill_net_assets",
		width: 160,
		render: renderFormat
	}
	const memberBillWithdrawalSubReviewDetail_historyShouldRepay = {
		title: "funds.settlement_bill_management.payable_bill_loan",
		width: 160,
		render: renderFormat
	}
	const memberBillWithdrawalSubReviewDetail_historyWithdrawAvailable = {
		title: "funds.settlement_bill_management.withdrawable_limit",
		width: 160,
		render: renderFormat
	}
	const memberBillWithdrawalSubReviewDetail_historyCashAvailable = {
		title: "report.center_wallet_balance",
		width: 160,
		render: renderFormat
	}
	const memberBillWithdrawalSubReviewDetail_historyCreditAvailable = {
		title: "funds.settlement_bill_management.credit_wallet_balance",
		width: 160,
		render: renderFormat
	}
	const memberBillWithdrawalSubReviewDetail_historyCreditTotal = {
		title: "funds.fund_audit.credit_limit",
		width: 160,
		render: renderFormat
	}
	const memberBillWithdrawalSubReviewDetail_applyUserName = {
		title: "funds.fund_audit.operator",
		width: 160
	}
	const memberBillWithdrawalSubReviewDetail_eventTime = {
		title: "funds.apply_time",
		width: 160
	}
	const memberBillWithdrawalSubReviewDetail_adjustTypeStr = {
		title: "funds.fund_audit.adjust_type",
		width: 160
	}
	const memberBillWithdrawalSubReviewDetail_orderAmount = {
		title: "funds.fund_audit.order_amount",
		width: 160,
		render: (v: number) => <a style={{ color: "red" }}>{renderFormat(v)}</a>
	}

	return {
		memberBillWithdrawalSubReviewDetail_userName,
		memberBillWithdrawalSubReviewDetail_parentProxyName,
		memberBillWithdrawalSubReviewDetail_merchantName,
		memberBillWithdrawalSubReviewDetail_accountStatus,
		memberBillWithdrawalSubReviewDetail_createdAt,
		memberBillWithdrawalSubReviewDetail_loanBillSnapshotTime,
		memberBillWithdrawalSubReviewDetail_asset,
		memberBillWithdrawalSubReviewDetail_shouldRepay,
		memberBillWithdrawalSubReviewDetail_withdrawAvailable,
		memberBillWithdrawalSubReviewDetail_cashAvailable,
		memberBillWithdrawalSubReviewDetail_creditAvailable,
		memberBillWithdrawalSubReviewDetail_creditTotal,
		memberBillWithdrawalSubReviewDetail_historyBillPeriod,
		memberBillWithdrawalSubReviewDetail_generatedTime,
		memberBillWithdrawalSubReviewDetail_historyAsset,
		memberBillWithdrawalSubReviewDetail_historyShouldRepay,
		memberBillWithdrawalSubReviewDetail_historyWithdrawAvailable,
		memberBillWithdrawalSubReviewDetail_historyCashAvailable,
		memberBillWithdrawalSubReviewDetail_historyCreditAvailable,
		memberBillWithdrawalSubReviewDetail_historyCreditTotal,
		memberBillWithdrawalSubReviewDetail_applyUserName,
		memberBillWithdrawalSubReviewDetail_eventTime,
		memberBillWithdrawalSubReviewDetail_adjustTypeStr,
		memberBillWithdrawalSubReviewDetail_orderAmount
	}
}

export default memberBillWithdrawalSubReviewDetailColumns
